import request from '@/utils/request'

// 根据房间ID查询设备列表
export function listByHomeId(homeId) {
  return request({
    url: '/lock/device/listByHomeId/' + homeId,
    method: 'get'
  })
} 

// 查询设备列表
export function listDevice(query) {
  return request({
    url: '/lock/device/list',
    method: 'get',
    params: query
  })
}

// 获取未激活锁数量
export function getUnactivatedLockCount(query) {
  return request({
    url: '/lock/device/unactivated/count',
    method: 'get',
    params: query
  })
}

// 获取信号弱的锁数量
export function getWeakSignalLockCount(query) {
  return request({
    url: '/lock/device/weaksignal/count',
    method: 'get',
    params: query
  })
}

// 获取通信时间异常的锁数量
export function getAbnormalDateLockCount(query) {
  return request({
    url: '/lock/device/abnormaldate/count',
    method: 'get',
    params: query
  })
}

// 获取管理员密码异常的锁数量
export function getAbnormalAdminPwdCount(query) {
  return request({
    url: '/lock/device/abnormaladmin/count',
    method: 'get',
    params: query
  })
}

// 查询电量低于指定值的锁数量
export function getLowBatteryLockCount(query) {
  return request({
    url: '/lock/device/lowBatteryCount',
    method: 'get',
    params: query
  })
}

// 获取3天未通讯的锁数量
export function getNoCommLockCount(query) {
  return request({
    url: '/lock/device/noCommuCount',
    method: 'get',
    params: query
  })
}

// 新增设备管理
export function addDevice(data) {
  return request({
    url: '/lock/device',
    method: 'post',
    data: data
  })
}

// 修改设备管理
export function updateDevice(data) {
  return request({
    url: '/lock/device',
    method: 'put',
    data: data
  })
}
